package com.yc.bank;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

public class MyWebConfig implements WebApplicationInitializer {
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext();
        cxt.register(BankConfig.class);

        servletContext.setInitParameter("contextConfigLocation", "classpath:beans.xml");
        servletContext.addListener(ContextLoaderListener.class);
    }
}
